﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TSqlServer;

/// <summary>
/// Tadsales 的摘要说明
/// </summary>
public class TAdSales:TData
{
    const string CTableName = "t_ad_sales";//表名
    const string CKeyName = "Salescode";//主键名

    public TAdSales()
    {
        FTableName = CTableName;
        FKeyName = CKeyName;
    }
    public TAdSales(string sid)
    {
    	FTableName = CTableName;
        FKeyName = CKeyName;
        FKeyValue = sid;
    }

    #region 表中字段属性
    private string FSalesCode;

    public string SalesCode
    {
        get { return FSalesCode; }
        set { FSalesCode = value; }
    }

    private string FSalesName;

    public string SalesName
    {
        get { return FSalesName; }
        set { FSalesName = value; }
    }

    private string FSex;

    public string Sex
    {
        get { return FSex; }
        set { FSex = value; }
    }

    private string FJobposi;

    public string Jobposi
    {
        get { return FJobposi; }
        set { FJobposi = value; }
    }

    private string FNotice;

    public string Notice
    {
        get { return FNotice; }
        set { FNotice = value; }
    }

    private int FStatus;

    public int Status
    {
        get { return FStatus; }
        set { FStatus = value; }
    }

    private string FInman;

    public string Inman
    {
        get { return FInman; }
        set { FInman = value; }
    }

    private DateTime FInTime;

    public DateTime InTime
    {
        get { return FInTime; }
        set { FInTime = value; }
    }
    #endregion

    //插入新记录。
    public void Insert()
    {
        string ExSql = "'" + FSalesCode + "','" + FSalesName + "','" + FSex + "','" + FJobposi + "','" + FNotice + "','" + FStatus + "','" + FInman + "','" + FInTime + "'";
        base.Insert(ExSql);
    }
    //更新记录。
    public void Update()
    {
        string ExSql = " Salesname ='" + FSalesName + "', Sex ='" + FSex + "', Jobposi='" + FJobposi + "', Notice ='" + FNotice + "', Status ='" + FStatus + "', Inman ='" + FInman + "', Intime ='" + FInTime + "'";
        base.Update(ExSql);
    }
    //改变状态,0=未验证,1=已通过验证
    public void Update_status()
    {
        string ExSql = "status=" + FStatus.ToString(); ;
        base.Update(ExSql);
    }

    public override void Select()
    {
        string strSql = GetSelectString();
        TSqlDB oDB = new TSqlDB(strSql);
        if (!oDB.EOF)
        {

            FSalesCode = oDB["Salescode"].ToString();
            FSalesName = oDB["Salesname"].ToString();
            FSex = oDB["Sex"].ToString();
            FJobposi = oDB["Jobposi"].ToString();
            FNotice = oDB["Notice"].ToString();
            FStatus = oDB["Status"].ToInt();
            FInman = oDB["Inman"].ToString();
            FInTime = oDB["Intime"].ToDateTime();
        }
        oDB.Free();
    }

    //静态，可以不用创建对象即可调用。
    public static void DeleteByID(string sID)
    {
        TData.DeleteByID(sID, CTableName, CKeyName);
    }
	
}
